import axios from 'axios';
const instance = axios.create();

// const post = function (url = "", data = {}, headers = {}) {
//     return new Promise((resolve, reject) => {
//         instance.post(url, data, { headers }).then(res => {
//             resolve(res.data)
//         }).catch(err => {
//             reject(err)
//         })
//     })
// }

const post = function (url = "", data = {}, headers = {}) {
    return instance.post(url, data, { headers }).then(res => {
        return res.data
    }).catch(err => {
        return err
    })
}

function get(url = "", data = {}, headers = {}) {
    instance.get(url, data, headers).then(res => {
        return res.data
    }).catch(err => {
        return err
    })
}
export { post, get }